<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%@ include file="/jsplib/pubhead.jsp"%>
<%@ page import="net.comm.common.ValueMaping" %>
<%@ taglib uri="/WEB-INF/myTaglib.tld" prefix="tag"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<TITLE>${theForm.name}:社区部落</TITLE>
	<link href="${cpath}/css/youlin.css" rel="stylesheet" type="text/css" media="all" />
	<link rel="stylesheet" type="text/css" href="${cpath}/css/pop.css">	
	<!--[if IE 6]>
	  <script type="text/javascript" src="${cpath}/jspng/DD_belatedPNG_0.0.8a-min.js"></script>
	  <script type="text/javascript" src="${cpath}/jspng/ie6-png.js"></script>
	<![endif]-->
</head>
<body>
<script> 
	function change_width(img_name,wid,hei)
	{
		var CurImage=new Image();
		if(CurImage.src!=img_name.src)
		{
			CurImage.src=img_name.src;
		}
		var img_width = CurImage.width;
		var img_height = CurImage.height;
		img_name.width = img_width;
		img_name.height = img_height;

		if(img_height/hei > img_width/wid)
		{
			if( img_height > hei)
			{
				img_name.width = img_name.width/img_name.height*hei;
				img_name.height = hei;
			}
		}
		else
		{
			if( img_width > wid)
			{
				img_name.height = img_name.height/img_name.width*wid;
				img_name.width = wid;
			}
		}
		return true;
	}
</script>
<!--外套 start -->
<div class="wrap">
  <!--页首 start -->
	<%@ include file="/menu.jsp"%>
  <!--页首 end -->  
  
  <!--导航面包屑 start -->
  <div class="breadCrumb">
  <div class="breadCrumbNav">当前位置：<a href="${cpath}/users.do?action=main">我的主页</a> >> <a href="${cpath}/shequ_home/villageID_${theForm.villageID}.html">社区广场</a> >> <a >部落</a> </div>
	<%@ include file="/navf.jsp"%>
 </div> 
  <!--导航面包屑 end -->
  
  <!--主体 start -->
 <div class="body theBody-buluo">
<div class="hotBox1" >  
    <div class="hotBox1-left">
         <div class="hotBox1-buluo" >  
          <img src="${cpath}/${myfn:getPic(theForm.pic)}" width="102" height="75" class="shequ icon user_icon_2"/>
          <p><b>${theForm.name}</b></p>
          <p>成员：${theForm.joinNum}人 <span class="w20"></span>所属社区:${myfn:getCnpcaName(theForm.work_location)}&nbsp;${myfn:getCnpcaName(theForm.work_sublocation)}&nbsp;${myfn:getCnpcaName(theForm.work_Area)}&nbsp;${myfn:getVillageName(theForm.villageID)}</p>
          <p>创建者：${myfn:getUserNick(theForm.userID)}<span class="w20"></span> 积分:${myfn:getUserIntegral(theForm.userID)}</p>
        </div>
      </div>
	</div>
 
   <div class="leftBar2">
       <div class="thebox6">
          <h3>创始人与管理员</h3>
          <div class="content content-gly">
			<ul>
				<c:forEach var="manager" items="${managerlist}" varStatus="status" end="3"> 
                   <li>
                   <p>
				   <a class="pic2" href="${cpath}/users_home/userID_${manager.userID}.html" target="_blank"><b></b><img src="${cpath}/${myfn:getUserPic(manager.userID)}"  width="48" height="48" border="0"/></a>
				   </p>
                   <p>${myfn:getUserNick(manager.userID)}</p>       
                   </li>
				</c:forEach> 
               </ul>
          </div>
       </div>
       <div class="thebox6">
          <h3>部落成员</h3>
          <div class="content content-gly">
			<ul>
 				<c:forEach var="member" items="${memberlist}" varStatus="status" end="3">   
				 <li>
                   <p>
				   <a class="pic2" href="${cpath}/users_home/userID_${member.userID}.html" target="_blank"><b></b><img src="${cpath}/${myfn:getUserPic(member.userID)}"  width="48" height="48" border="0"/></a>
				   </p>
                   <p>${myfn:getUserNick(member.userID)}</p>     
                 </li>
				</c:forEach> 
            </ul>
          </div>
       </div>
       <div class="thebox6">
         <div class="content content-link">
            <ul>
			<c:if test="${addflg == 'no'}"> 
			<li><a href="${cpath}/gmember.do?action=add&userID=${userID}&groupID=${theForm.groupID}">加入部落</a></li> </c:if>
			<c:if test="${addflg != 'no'  && (memType == '2' || memType == '3')}"> 
			<li><a href="${cpath}/gmember.do?action=delete&userID=${userID}&groupID=${theForm.groupID}">脱离部落</a></li> </c:if>
			<c:if test="${memType == '1' || memType == '2'}"> 
			<li><a href="${cpath}/group.do?action=modifyPage&groupID=${theForm.groupID}">管理部落</a></li>
			<li><a href="${cpath}/gmember.do?action=list&qryGroupID=${theForm.groupID}">管理部落成员</a></li>
			</c:if>
			<c:if test="${addflg != 'no' }"> 
			<li><a href="javascript:openNewDiv('msg');">邀请邻居加入部落</a></li> </c:if>			  
            </ul>
         </div>       
       </div>
       <div class="thebox7"></div>
   </div>
   
   <div class="mainBar2">
    
    <div class="thebox8">
      <h3>部落宣言</h3>
      <div class="content">     
       ${fn:substring(theForm.subject,0,200)}
      </div>
     </div>
     
    <div class="thebox9">
      <h3>照片区</h3>
      <a class="more7" href="${cpath}/galbum.do?action=list&qryGroupID=${theForm.groupID}">更多</a>	
      <div class="content content-xc">
        <ul class="theAlbumList4">
            <c:forEach var="pic" items="${piclist}" varStatus="status"> 
            <li>
              <p class="p1"><a href="${cpath}/gpic_views/qryGpicID_${pic.gpicID}_qryGAlbumID_${pic.galbumID}.html"><img src="${cpath}/${myfn:getPic(pic.picName)}" /></a> </p> 
               <p class="p2">上传：<a href="${cpath}/users_home/userID_${pic.userID}.html">${myfn:getUserNick(pic.userID)}</a></p>
             </li> 
			</c:forEach> 	 
        </ul>
        <c:if test="${myfn:groupAddFlag(theForm.groupID,userID) == 1}">
			       <p align="right" style="vertical-align: bottom"><a href="${cpath}/gpic.do?action=addPage&qryGroupID=${theForm.qryGroupID}&galbumID=${albumForm.galbumID}"><img src="${cpath}/images/icon_26.gif" width="70" height="30" /></a></p>  
			  </c:if>	 
      </div>       
     </div>
    <div class="thebox9">
      <h3>话题区</h3>
      <a class="more7" href="${cpath}/gforum_adlist/qryGroupID_${theForm.groupID}.html">更多</a>
      <div class="content">
      <dl class="dl-ht">
        <dt>
          <span class="s1">话题</span><span class="s2">浏览</span><span class="s3">回复</span><span class="s4">作者</span><span class="s5">时间</span>
        </dt>
		<c:forEach var="forum" items="${forumlist}" varStatus="status">   
          <dd>
            <span class="s1"><a href="${cpath}/gfollforum_list/qryGForumID_${forum.GForumID}.html"><c:out value="${forum.title}"></c:out></a></span><span class="s2">${forum.attachcnt}</span><span class="s3">${forum.replycnt}</span><span class="s4"><a href="${cpath}/users_home/userID_${forum.userID}.html">${myfn:getUserNick(forum.userID)}</a></span><span class="s5">${myfn:formatMDHM(forum.mtime)}
			</span>
          </dd>
		</c:forEach>
      </dl>
		  <div class="bl-rightBox-2">
            <form action="${cpath}/gforum.do?action=adlist" name="forumForm"  method="post">
            <p>查找<input class="input" name="qryTitle" type="text" /><a href="javascript:forumFind();"><img src="${cpath}/images/search02.gif" width="59" height="18" /></a></p>
			<input type="hidden" name='qryGroupID' value='${theForm.groupID}'/>
            </form>
			<c:if test="${myfn:groupAddFlag(theForm.groupID,userID) == 1}">
            <a href="${cpath}/gforum.do?action=addPage&groupID=${theForm.groupID}" class="btn2"><img src="${cpath}/images/icon_bl_07.gif" width="120" height="32" /></a>
			</c:if>
          </div>
      </div>
     </div>

	 <div class="thebox9">
      <h3>活动区</h3>
      <a class="more7" href="${cpath}/gparty.do?action=adlist&qryGroupID=${theForm.groupID}">更多</a>
      <div class="content">
      <dl class="dl-hd">
        <dt>
          <span class="s1">类型</span><span class="s2">标题</span><span class="s3">已报名</span><span class="s4">发送者</span><span class="s5">活动时间</span>
        </dt>
 			<c:forEach var="party" items="${partylist}" varStatus="status">   
             <dd>
               <span class="s1">${myfn:getProperty(6,party.firsort)}</span>
               <span class="s2"><a href="${cpath}/gparty_info/partyID_${party.partyID}.html"><c:out value="${party.title}"></c:out></a></span>
               <span class="s3">
			    <c:if test="${addflg == 'no' && !myfn:bjudgeRange(party.signEtime) }"> 
				 <A href="javascript:addSign('${theForm.groupID}','${party.partyID}');"><font color="red">加入并报名</font></a></A>
				</c:if>
 				<c:if test="${addflg == 'yes' && !myfn:bjudgeRange(party.signEtime) && theForm.userID != userID }"> 
				 <A href="${cpath}/gsignup.do?action=add&partyID=${party.partyID}"><img src="${cpath}/images/an01.png" /></A>
				</c:if>
				<c:if test="${myfn:bjudgeRange(party.endtime)}">活动结束</c:if>
			   </span>
               <!--<span class="s3"><c:out value="${party.signNum}"></c:out></span>-->
               <span class="s4"><a href="${cpath}/users_home/userID_${party.userID}.html">${myfn:getUserNick(party.userID)}</a></span>
               <span class="s5">${myfn:formatMDHM(party.bgtime)}</span>
             </dd>
			</c:forEach>       
       
        </dl>
		  <div class="bl-rightBox-2">
            <form action="${cpath}/gparty.do?action=adlist" name="partyForm"  method="post">
            <p>查找<input class="input" name="qryTitle" type="text" /><a href="javascript:partyFind();"><img src="${cpath}/images/search02.gif" width="59" height="18" /></a></p>
			<input type="hidden" name='qryGroupID' value='${theForm.groupID}'/>
            </form>
            <c:if test="${myfn:groupAddFlag(theForm.groupID,userID) == 1}">
			<a href="${cpath}/gparty.do?action=addPage&groupID=${theForm.groupID}" class="btn2"><img src="${cpath}/images/icon_bl_09.gif" width="120" height="32" /></a>
			</c:if>
          </div>
      </div>
     </div>
     
   </div>
   
   <div class="clearFloat"></div>
 </div> 
 <!--主体 end -->
 
 
 <!--页脚 start -->
	<%@ include file="/foot.jsp"%>
 <!--页脚 end --> 
</div>
<!--外套 end -->
 		<!-- 站内邮件 弹出层 -->
		<DIV class=dragdiv id=msg style="DISPLAY:none ">
		<DIV class="otherdiv filterbox">
		<B class=g1></B><B class=g2></B><B class=g3></B><B class=g4></B>
		<DIV class="content filterbox"></DIV>
		<B class=g4></B><B class=g3></B><B class=g2></B><B class=g1></B></DIV>
		<DIV class=otherdivin>
		<H2><SPAN><A title=关闭 style="CURSOR: pointer" onclick="closeMask('msg')"><IMG src="${cpath}/icon/remove.png"></A></SPAN>发送站内信： </H2>
 		<form action="${cpath}/msg.do?action=send" name="msgForm"  method="post" >
			<DL  id="emaildl">
			<DD><EM>邻  居：</EM><DIV id='friendselect'>
			<select name='receiver'  onkeydown='catch_keydown(this);' >
				<c:forEach var="linju" items="${linjulist}" varStatus="status">   
				<option value="${linju.linjuID}" >${myfn:getUserNick(linju.linjuID)}
				</c:forEach> 		
			</select>
			</div></DD>
			<DD><EM>留  言：</EM></DD>
			<DD><textarea name="msg" rows="6" cols="45" >${myfn:getUserNick(userID)}邀请您加入${theForm.name}   网址：<a href="http://www.iyoulin.com/group_get/groupID_${theForm.groupID}.html" target="_blank">http://www.iyoulin.com/group_get/groupID_${theForm.groupID}.html</a></textarea>
			</DD>
			<DD><EM><INPUT type=button class='shortBtn' name=send value="确  定" onclick="domsg();">&nbsp;&nbsp;
			<INPUT type=button class='shortBtn'  name=cancel value="取  消" onclick="closeMask('msg');"></EM>
			</DD>
			</DL>
			<!--隐藏域-->
			<input type="hidden" name='title' id='title' value='${name}邀请您加入部落：${theForm.name}'/>
			<input type="hidden" name='sender' id='sender' value='${userID}'/>
			<input type="hidden" name='mtype'  id='mtype' value='5'/>
		</form>  
		</DIV></DIV><!-- 弹出层结束 -->
</body>
</html>
<script>
	//弹出提示层
	function openNewDiv(_id) 
	{
		var m = "mask";
		if(document.getElementById(m)) document.body.removeChild(document.getElementById(m));
		var newMask = document.createElement("div");
		newMask.id = m;
		newMask.style.position = "absolute";
		newMask.style.zIndex = "1";
		_scrollWidth = Math.max(document.body.scrollWidth,document.documentElement.scrollWidth);
		_scrollHeight = Math.max(document.body.scrollHeight,document.documentElement.scrollHeight);
		newMask.style.width = _scrollWidth + "px";
		newMask.style.height = _scrollHeight + "px";
		newMask.style.top = "0px";
		newMask.style.left = "0px";
		newMask.style.background = "#33393C";
		newMask.style.filter = "alpha(opacity=40)";
		newMask.style.opacity = "0.30";
		document.body.appendChild(newMask);
		showDiv = document.getElementById(_id);
		showDiv.style.display = "block";
		showDiv.style.position = "absolute";
		showDiv.style.zIndex = "9999";
		showDivWidth = 488;
		showDivHeight = 314;
		showDiv.style.top = (document.documentElement.scrollTop + document.documentElement.clientHeight/2 - showDivHeight/2) + "px";
		showDiv.style.left = (document.documentElement.scrollLeft + document.documentElement.clientWidth/2 -  showDivWidth/2) + "px";
	}
	function closeMask(_id)
	{
		var m = "mask";
		if(document.getElementById(m)) document.body.removeChild(document.getElementById(m));
		showDiv = document.getElementById(_id);
		showDiv.style.display = "none";
	}
	
	function my_getbyid(id)
	{
		 itm = null;
		 if (document.getElementById)
		 {
				itm = document.getElementById(id);
		 }
		 else if (document.all)
		 {
				itm = document.all[id];
		 }
		 else if (document.layers)
		 {
				itm = document.layers[id];
		 }	 
		 return itm;
	}
  /**
   * 取得所有好友
   */
	function getFriends(id, userID)
	{
		var url = "${cpath}/friend/getfriends.jsp?userID=" + userID;

		var xmlHttp;
		start = true;
		try
		{ // Firefox, Opera 8.0+, Safari    
			xmlHttp=new XMLHttpRequest();
		}
		catch (e)
		{ // Internet Explorer    
			try
			{
				xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
			}
			catch (e)
			{
				try
				{
					xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
				}
				catch (e)
				{
					alert("Your browser does not support AJAX!");
					return false;
				}
			}
		}
		if (start)
		{
			xmlHttp.onreadystatechange=function()
			{
				if(xmlHttp.readyState==4 && xmlHttp.status==200)
				{
					var ret_str = "<select name='receiver' value='' onkeydown='catch_keydown(this);' >";
						
					ret_str += xmlHttp.responseText;

					ret_str += "</select>";

					my_getbyid(id ).innerHTML = ret_str;
				}
			}

			xmlHttp.open("GET",url,true);
			xmlHttp.send(null);
		}
	}
  /**
   * 发送站内邮件
   */
	function domsg()
	{
		var form = document.msgForm;
		var msg = form['msg'];
		var receiver = form['receiver'];

		if(receiver.value.replace(/(^\s*)|(\s*$)/g,"").length == 0){

			alert("请选择好友！");
			return;
		}

		if(msg.value.replace(/(^\s*)|(\s*$)/g,"").length == 0){

			msg.value = "${name}邀请您加入群组：<a href='${cpath}/group.do?action=get&groupID=${theForm.groupID}'>${theForm.name}</a>"

		}
		form.submit();
	}
 /**
   * 发送邮件
   */
	function doemail()
	{

		var form = document.emailForm;
		var cont = form['cont'];
		var email = form['email'];

		if(email.value.replace(/(^\s*)|(\s*$)/g,"").length == 0){

			alert("请输入email！");
			return;
		}

		if(cont.value.replace(/(^\s*)|(\s*$)/g,"").length == 0){

			cont.value = "${name}邀请您加入群组：<a href='${cpath}/group.do?action=get&groupID=${theForm.groupID}'>${theForm.name}</a>"

		}
		form.submit();
	}
    /**
     * 加入部落并参加活动
     */
	function addSign(groupid, partyid)
	{
		if(confirm("加入部落并参加活动吗？")){
			window.location.href  = "${cpath}/gmember.do?action=addSign&groupID=" + groupid + "&partyID=" + partyid;

		}
	}

    /**
     * 话题搜索
     */
	function forumFind()
	{
		var form = document.forumForm;

		form.submit();
	}
    /**
     * 活动搜索
     */
	function partyFind()
	{
		var form = document.partyForm;

		form.submit();
	}

</script>
